#include "exttool.h"

QString ExtTool::getLnkFileNameTruePath(QString lnkName) {
    if (lnkName.isEmpty() 
        || lnkName.indexOf(".lnk") == -1) { return "-1"; }
    QFileInfo info(lnkName);
    return info.absoluteFilePath();
#if 0
    CoInitialize(0);
    BOOL bRet = FALSE;
    IShellLinkW* shLnk = 0;
    IPersistFile * persist = 0;
    WIN32_FIND_DATA wfd;
    PWSTR myXbpathBuf = NULL;

    HRESULT hr = CoCreateInstance(
        CLSID_ShellLink,
        NULL,
        CLSCTX_INPROC_SERVER,
        IID_IShellLinkW,
        (void**)shLnk);

    PWSTR OepnFileNameBuffer;
    if (SUCCEEDED(hr)) {
        hr = shLnk->QueryInterface(IID_IPersistFile, (void**)&persist);
        if (SUCCEEDED(hr)) {
            hr = persist->Load(L"Asadsadsa", STGM_READ);
            if (SUCCEEDED(hr)) {
                hr = shLnk->GetPath(
                    OepnFileNameBuffer,
                    lnkName.size(),
                    &wfd,
                    SLGP_RAWPATH);
            }
            persist->Release();
        }
        shLnk->Release();
    }
    CoUninitialize();
    return QString::fromWCharArray(OepnFileNameBuffer);
#endif
}